using System.Windows.Forms;

namespace CosyTrade.UI
{
    public class CursorHelper : System.IDisposable
    {
        private readonly Form form;
        private readonly Cursor norCursor;

        public CursorHelper(Form form)
            : this(form, Cursors.WaitCursor)
        {
        }

        public CursorHelper(Form form, Cursor toCursor)
        {
            norCursor = form.Cursor;
            this.form = form;
            form.Cursor = toCursor;
        }

        public void Dispose()
        {
            form.Cursor = norCursor;
        }
    }
}